<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/icon.css">
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>

		$(function(){
					
			/*表格初始化*/
			$("#grid").datagrid({
				singleSelect:false,
				fit:true,
				//fitColumns:true,
				collapsible:true, 
				//width:'auto',
				striped:true,
				rownumbers:true, 
			    columns:[[    
			    	{field:'CK',checkbox:true},
			        {field:'company_name',title:'企业名称',width:250,align:'left'},
			        {field:'is_del',title:'is_del',width:50,align:'left'},
			        {field:'cert_num',title:'资质证书号码',width:260,align:'left'},  
			        {field:'lx',title:'类型',width:250,align:'right'},
			        {field:'dl',title:'大类',width:250,align:'right'},
			        {field:'xl',title:'小类',width:250,align:'right'},
			        {field:'zy',title:'专业',width:150,align:'right'},
			        {field:'level_name',title:'资质项目等级',width:100,align:'center'},
			        {field:'issued_date',title:'发证日期',width:100,align:'center'}, 
			        {field:'issued_by',title:'发证机关',width:220,align:'left'},
			        {field:'expiry_date',title:'有效日期',width:100,align:'center'},
			        {field:'filing',title:'入川备案',width:70,align:'right'},
			        {field:'data_source_name',title:'数据来源',width:300,align:'left'}
			    ]],
			    pagination:true,
			    pageSize:20,
			    pageList:[10,20,30,50,100,200,500]
			});
			
			
			//下拉框加载数据,
			
			//数据来源
			$('#search_data_source').combobox({    
			    url:'/common/dict/getComboboxDataSourceDict',    
			    valueField:'code',
			    width:270,
			    textField:'name',
			    filter: function(q, row){
					var opts = $(this).combobox('options');
					return row[opts.textField].indexOf(q) >= 0;
				}
			});
			//设置默认值
			$('#search_data_source').combobox('setValue','chongqing')

			//证书字典
			$('#search_cert_dict').combobox({    
			    url:'/common/dict/getComboboxCompanyCertDict',    
			    valueField:'code',
			    width:400,
			    textField:'name',
			    filter: function(q, row){
					var opts = $(this).combobox('options');
					return row[opts.textField].indexOf(q) >= 0;
				}
			});
			
			//查询按钮
			$("#search_btn").click(function(){
				$("#grid").datagrid({
					url:'/middleLib/companyCert/getCompanyCertList',
					method:"POST",
					queryParams: parent.getFormJson($("#search_form"))
				});
			});

			//删除勾选
			$("#delete_one_all").click(function(){
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}
				var data_source = parent.getFormJson($("#search_form")).data_source_code
				var apt_id_list = rows[0].apt_id
				for(var i= 1 ;i<rows.length;i++){
					apt_id_list = apt_id_list + "^"+rows[i].apt_id
				}
				$.post("/middleLib/companyCert/deleteMany",{apt_id_list:apt_id_list,data_source:data_source},function(response){
						$.messager.alert('提示',JSON.stringify(response));
						$("#search_btn").click();
				})
			});
		});
		</script>
	</head>
	<body class="easyui-layout">
		
		
		
		<!-- 主表格 -->
		<div region="center" border="false">
            <div id ="toolbar">
                <form id ="search_form" method="post" class="easyui-form">
                    <table width="100%" height="10%">
                        <tr align = "left">
                            <td align="right" width="5%">企业名称:</td>
                            <td width="20%"  align="left" >
                                <input class="easyui-textbox"  name="company_name" style="width:400px"  />
                            </td>
                            <td align="right" width="5%">数据来源:</td>
                            <td width="10%"  align="left">
                                <input  class="easyui-combobox" id = "search_data_source"  panelHeight='auto' name="data_source_code" style="width:100px" />
                            </td>
                            <td align="right" width="5%">证书类别:</td>
                            <td width="25%"  align="left">
                                <input  class="easyui-combobox" id = "search_cert_dict"  panelHeight='auto' name="cert_dict_id" style="width:400px" />
                            </td>
                        </tr>
                    </table>
                </form>
                <a href="#" id="search_btn" class="easyui-linkbutton"	 data-options="iconCls:'icon-search'"  >查询</a>
                <a href="#" id='delete_one_all' class="easyui-linkbutton" data-options="iconCls:'icon-reload'">删除勾选资质</a>
            </div>

			<table id="grid" data-options="toolbar:'#toolbar'" />
        </div>
	</body>
</html>
